import { storage, defineStore, keys } from 'src/plugins/pinia/common';

export default defineStore('sys', {
	'state': () => ({
		count: 1,
		dataTheme: 'dark',
		isCollapse: false,
		lang: 'zh'
	}),
	'actions': {
		theme(theme) {
			this.dataTheme = theme;
		},
		addCount(count) {
			this.count = this.count + count;
		},
		delCount(count) {
			this.count = this.count - count;
		}
	},
	'persist': {
		'enabled': true,
		// 修改存储中使用的键名称，默认为当前 Store的 id
		'key': keys.sys,
		// 修改为 sessionStorage，默认为 localStorage
		storage
	}
});